home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 476 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.0 KB

  1. Path: engnews1.Eng.Sun.COM!taumet!clamage
  2. From: vandevod@cs.rpi.edu (David Vandevoorde)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Templates; what does the standard mean here...
  5. Date: 24 Feb 1996 17:15:14 GMT
  6. Organization: RPI Computer Science
  7. Sender: vandevod@avs.cs.rpi.edu
  8. Approved: clamage@eng.sun.com (comp.std.c++)
  9. Message-ID: <xso3f80spxf.fsf@avs.cs.rpi.edu>
  10. References: <4gief4$pv6@news.bridge.net>
  11. NNTP-Posting-Host: taumet.eng.sun.com
  12. X-Nntp-Posting-Host: avs.cs.rpi.edu
  13. In-Reply-To: David Byrden's message of 22 Feb 96 20:22:36 GMT
  14. X-Newsreader: Gnus v5.1
  15. Originator: clamage@taumet
  16.  
  17. >>>>> "DB" == David Byrden <100101.2547@compuserve.com> writes:
  18. DB> From the January draft standard:
  19. [...]
  20. DB>           template-argument:
  21. DB>                   assignment-expression
  22. DB>                   type-id
  23. DB>                   template-name
  24.  
  25.  
  26. DB>  Notice the third-last line, "assignment-expression". 
  27.  
  28. Assignment expressions are described in Chapter 5 ([expr.assign] or 
  29. something similar). They're basically your classical expression with
  30. operation precedence downto assignments (e.g., not a comma-expression).
  31.  
  32. DB>  Call me dumb, but I must ask what does this mean? What does the 
  33. DB> expression specify, a type or a value? Will an assignment be made at run 
  34. DB> time?
  35.  
  36. This is for non-type template arguments.
  37.  
  38. This is only the syntax description. In [temp.arg] you should find
  39. that the expression must be a non-floating-type, constant expression
  40. (i.e., one that can easily be determined at compile-time).
  41.  
  42. DB>  Can you give me any examples of templates specialised with an 
  43. DB> assignment-expression?
  44.  
  45.     template<bool B> struct PlaceHolder {};
  46.  
  47.     PlaceHolder<(4<5)> hello_variable;
  48.  
  49.  
  50.     Daveed
  51. [ To submit articles: Try just posting with your newsreader.
  52.               If that fails, use mailto:std-c++@ncar.ucar.edu
  53.   FAQ:    http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
  54.   Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
  55.   Comments? mailto:std-c++-request@ncar.ucar.edu
  56. ]
  57.